package control
import (
	"fmt"
	"project06/common/message"
	"project06/client/model"
)

var onlineUserMap map[int]*message.User = make(map[int]*message.User,10)
var curUser model.CurUser

func outputUserOnline(){
	fmt.Println("用户在线列表如下：")
	for i,_:=range onlineUserMap{
		fmt.Println("用户id:\t",i)
	}
}
func outputGroupMes(sms *message.SmsResMes){
	infostr:=fmt.Sprintf("用户%d:\t对大家说%s",sms.User.UserId,sms.Content)
	fmt.Println(infostr)
	fmt.Println()
}
func updateUserStatus(UserStatusNotifyMes message.UserStatusNotifyMes){
	user,ok:=onlineUserMap[UserStatusNotifyMes.UserId]
	if !ok{
		user =&message.User{}
		user.UserId=UserStatusNotifyMes.UserId
	}
	user.UserStatus=UserStatusNotifyMes.Status
	onlineUserMap[user.UserId]=user
	outputUserOnline()
}